package com.hkts.naturalgas.base.controller;


        import org.springframework.web.bind.annotation.RequestMethod;
        import org.springframework.web.bind.annotation.RestController;
        import com.hkts.naturalgas.utils.CustomPageUtils;
        import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
        import com.hkts.naturalgas.utils.Result;
        import com.hkts.naturalgas.utils.ResultUtil;
        import com.alibaba.fastjson.JSON;
        import org.springframework.ui.Model;
        import org.springframework.web.bind.annotation.RequestMapping;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.web.bind.annotation.RequestMethod;
        import org.springframework.web.bind.annotation.ResponseBody;
        import org.springframework.web.bind.annotation.GetMapping;

        import javax.servlet.http.HttpServletRequest;
        import javax.servlet.http.HttpServletResponse;

        import com.hkts.naturalgas.base.service.IRoastingoneRstwoRsjthreeService;
        import com.hkts.naturalgas.base.entity.RoastingoneRstwoRsjthree;
        import org.slf4j.Logger;
        import org.slf4j.LoggerFactory;

        import java.text.ParseException;
        import java.util.List;
        import java.util.ArrayList;
        import java.util.HashMap;
        import java.util.Map;

/**
 *
 * @author yck
 * @since 2021-06-21
 */
@RestController
@RequestMapping("/instrumentdata/roastingoneRstwoRsjthree")
public class RoastingoneRstwoRsjthreeController {
    private final Logger logger=LoggerFactory.getLogger(RoastingoneRstwoRsjthreeController.class);

    @Autowired
    public IRoastingoneRstwoRsjthreeService iRoastingoneRstwoRsjthreeService;

    /**
     * 分页查询数据
     *
     * @param page  分页信息
     * @param roastingoneRstwoRsjthree 查询条件
     * @return
     */
    @ResponseBody
    @GetMapping("/getRoastingoneRstwoRsjthreePageList")
    public Result<Object> getHontUserList(Page<RoastingoneRstwoRsjthree> page,RoastingoneRstwoRsjthree roastingoneRstwoRsjthree){
        return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingoneRstwoRsjthreeService.selectPage(page, roastingoneRstwoRsjthree)));
    }
    /**
     * 保存和修改公用的
     * @param roastingoneRstwoRsjthree 传递的实体
     * @return saveOrUpdate
     */
    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/roastingoneRstwoRsjthreeSave")
    public Result<Object> roastingoneRstwoRsjthreeSave(RoastingoneRstwoRsjthree roastingoneRstwoRsjthree){
        iRoastingoneRstwoRsjthreeService.saveOrUpdate(roastingoneRstwoRsjthree);
        return ResultUtil.success("保存成功");
    }

    /**
     * 根据id获取对象
     *
     * @param id 实体ID
     * @return 0 失败  1 成功
     */
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/roastingoneRstwoRsjthreeGetById")
    public Result<Object> roastingoneRstwoRsjthreeGetById(String id){
        RoastingoneRstwoRsjthree byId=iRoastingoneRstwoRsjthreeService.getById(id);
        return ResultUtil.data(byId);
    }

    /**
     * 根据id删除对象
     * @param id  实体ID
     * @return 0 失败  1 成功
     */
    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/roastingoneRstwoRsjthreeDelete")
    public Result<Object> hontUserDelete(String id){
        iRoastingoneRstwoRsjthreeService.removeById(id);
        return ResultUtil.success("删除成功");
    }
    /**
     * 批量删除对象
     * @param item 实体集合ID
     * @return  0 失败  1 成功
     */
    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/roastingoneRstwoRsjthreeBatchDelete")
    public Result<Object> deleteBatchIds(String item){
        List<String> ids=(List<String>)JSON.parse(item);
        iRoastingoneRstwoRsjthreeService.removeByIds(ids);
        return ResultUtil.success("删除成功");
    }
    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/addHostoryData")
    public Result<String> addHostoryData(String startDate,String endDate) throws Exception {
        iRoastingoneRstwoRsjthreeService.addHostoryData(startDate,endDate);
        return ResultUtil.data("处理成功");
    }


    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/handlerPresserData")
    public Result<String> handlerPresserData(String endDate) throws ParseException {
        iRoastingoneRstwoRsjthreeService.handlerPresserData(endDate);
        return ResultUtil.data("处理成功");
    }

    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/handlerCurveData")
    public Result<String> handlerCurveData(String startDate,String endDate,Float mbt,String order) throws ParseException {
        iRoastingoneRstwoRsjthreeService.handlerCurveData(startDate,endDate,mbt,order);
        return ResultUtil.data("处理成功");
    }
}
